using System;
using System.Windows;
using DeSleeper.Client.Properties;
using DeSleeper.Client.WakeOnLanService;
using DeSleeper.Library;

namespace DeSleeper.Client.WakeUp
{
    public class LocalWakeUpMethod : MacAddressWakeUpMethod
    {
        public LocalWakeUpMethod() {}
        public LocalWakeUpMethod(TargetComputer target) : base(target) { }

        protected override void WakeUpCore(WakeUpServiceClient serviceClient)
        {
            if (!IsValid)
                throw new InvalidOperationException(Resources.ErrorInvalidMACAddress);

            WakeOnLanHelper.WakeUp(MacAddress);
        }

        ///<summary>
        /// Creates a new instance to support cloning.
        ///</summary>
        protected override Freezable CreateInstanceCore()
        {
            return new LocalWakeUpMethod(Target);
        }
    }
}